function add_column(){
    const index = layer.open({
        type: 1,
        skin: "layui-layer-rim",
        area: ["400px", "200px"],
        title: "新增栏目",
        offset: '80px',
        content: '<div class="text-center" style="margin-top:20px;font-family: 华文中宋,sans-serif"><h4>请输入新的栏目名称</h4><input type="text" id="new_column" placeholder="输入栏目名称"/> </div>',
        btn: ['确定', '取消'],
        yes: function () {
            column_name = $('#new_column').val();
            $.ajax({
                url: '/article/add_column/',
                type: 'POST',
                data: {"column": column_name},
                success: function (resp) {
                    if (resp.status === 'true') {
                        layer.msg(resp.msg,{icon:1,time:1000},function (){
                            layer.close(index)
                            parent.location.reload();
                        });

                    } else {
                        layer.msg(resp.msg,{icon:2,time:1500})
                    }
                },
                error:function (){
                    location.href='/account/login/';
                    alert('请登录后重试！');
                }
            });
        },
        btn2: function (index) {
            layer.close(index);
        }
    });
}
function edit_column(the, column_id){
    var name = $(the).parents("tr").children("td").eq(1).text();
    var index = layer.open({
        type: 1,
        skin: "layui-layer-rim",
        offset: '200px',
        area: ["400px", "200px"],
        title: "编辑栏目",
        content: '<div class="text-center" style="margin-top:20px;font-family: 华文中宋,sans-serif"> <h4>请输入新的栏目名称</h4> <p><input type="text" id="new_name" value="'+name+'"></p> </div>',
        btn:['确定', '取消'],
        yes: function(){
                new_name = $("#new_name").val();
                $.ajax({
                url: "/article/rename_column/",
                type: "POST",
                data: {"column_id": column_id, "column_name": new_name},
                success: function(resp){
                    if(resp.status === 'true'){
                        layer.msg(resp.msg,{time:1000},function (){
                            layer.close(index);
                            parent.location.reload();
                        })
                    }else{
                        layer.msg(resp.msg,{time:1500})
                    }
                },
                error:function (){
                    location.href='/account/login/';
                    alert('请登录后重试！');
                }
              });
          },
        });
    }
function del_column(the, column_id){
    var name = $(the).parents("tr").children("td").eq(1).text();
    var index = layer.open({
        type: 1,
        skin: "layui-layer-rim",
        offset: '200px',
        area: ["400px", "190px"],
        title: "删除栏目",
        content: '<div class="text-center" style="margin-top:20px;font-family: 华文中宋,sans-serif"><h4>确认删除?</h4><h4 style="color: #419641;font-style: italic">'+name+'</h4></div>',
        btn:['确定', '取消'],
        yes: function(){
                $.ajax({
                url: "/article/del_column/",
                type: "POST",
                data: {"column_id": column_id},
                success: function(resp){
                    if(resp.status === 'true'){
                        layer.msg(resp.msg,{time:400},function (){
                            layer.close(index);
                            parent.location.reload();
                        })
                    }else{
                        layer.msg(resp.msg,{time:1000})
                    }
                },
                error:function (){
                    location.href='/account/login/';
                    alert('请登录后重试！');
                }
              });
          },
        });
    }